<?php
	
require_once("nusoap/nusoap.php");

function createProxy ($soap_url) {

	if (isset($_SESSION["sugar_soap_proxy"])) {
		unset($_SESSION["sugar_soap_proxy"]);
	}
	$soapclient = new nusoap_client($soap_url,'wsdl');
               $proxy = $soapclient->getProxy();
	$_SESSION["sugar_soap_proxy"] = $proxy;

        return $proxy;
}

function getProxy ($soap_url) {
	
	if (isset($_SESSION["sugar_soap_proxy"])) {
		return $_SESSION["sugar_soap_proxy"];
	} else {
		return createProxy($soap_url);
	}
		
}
		
?>
